package com.xg.xgaicodemother.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

import java.io.Serial;

import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.crypto.KeyGenerator;

/**
 * 用户 实体类。
 *
 * @author <a href="https://gitee.com/hisde">小郭</a>
 */
@Data
@Builder // 构建者模式
@NoArgsConstructor
@AllArgsConstructor
@Table("user")
public class User extends BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id(keyType = KeyType.Generator , value = KeyGenerators.snowFlakeId)
    private Long id;

    /**
     * 账号
     */
    @Column("user_account")
    private String userAccount;

    /**
     * 密码
     */
    @Column("user_password")
    private String userPassword;

    /**
     * 用户昵称
     */
    @Column("user_name")
    private String userName;

    /**
     * 用户头像
     */
    @Column("user_avatar")
    private String userAvatar;

    /**
     * 用户简介
     */
    @Column("user_profile")
    private String userProfile;

    /**
     * 用户角色: user/admin/vip
     */
    @Column("user_role")
    private String userRole;

    /**
     * 会员过期时间
     */
    @Column("vip_expire_time")
    private LocalDateTime vipExpireTime;

    /**
     * 会员兑换码
     */
    @Column("vip_code")
    private String vipCode;

    /**
     * 会员编号
     */
    @Column("vip_number")
    private Long vipNumber;

    /**
     * 编辑时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("edit_time")
    private LocalDateTime editTime;

    /**
     * 用户状态: 0-正常,1-停用
     */
    @Column("user_status")
    private Integer userStatus;

    /**
     * 是否删除: 0-未删,1-已删
     */
    @Column(isLogicDelete = true)
    private Integer isDelete;

}
